class SaleOrderLine {
  String? orderId;
  String? type;
  String? defaultCode;
  String? productName;
  String? description;
  String? priceUnit;
  String? productUomQty;
  String? autoid;
  String? unit;
  String? totalPrice;
  String? entityname;
  String? customercontactperson;
  String? customercontactphone;

  SaleOrderLine({
    this.orderId,
    this.type,
    this.defaultCode,
    this.productName,
    this.description,
    this.priceUnit,
    this.productUomQty,
    this.autoid,
    this.unit,
    this.totalPrice,
    this.entityname,
    this.customercontactperson,
    this.customercontactphone,
  });

  SaleOrderLine copyWith({
    String? id,
    String? orderId,
    String? name,
    String? sequence,
    String? invoiceStatus,
    String? priceUnit,
    String? priceSubtotal,
    String? priceTax,
    String? priceTotal,
    String? priceReduce,
    String? priceReduceTaxinc,
    String? priceReduceTaxexcl,
    String? discount,
    String? productId,
    String? productUomQty,
    String? productUom,
    String? qtyDeliveredMethod,
    String? qtyDelivered,
    String? qtyDeliveredManual,
    String? qtyToInvoice,
    String? qtyInvoiced,
    String? untaxedAmountInvoiced,
    String? untaxedAmountToInvoice,
    String? salesmanId,
    String? currencyId,
    String? companyId,
    String? orderPartnerId,
    String? isExpense,
    String? isDownpayment,
    String? state,
    String? customerLead,
    String? displayType,
    String? createUid,
    String? createDate,
    String? writeUid,
    String? writeDate,
    String? productPackaging,
    String? routeId,
    String? autoid,
    String? outercolor,
    String? entityname,
    String? deliveryaddress,
    String? customercontactperson,
    String? customercontactphone,
    String? executecompany,
    String? remark,
  }) {
    return new SaleOrderLine(
      priceUnit: priceUnit ?? this.priceUnit,
      productUomQty: productUomQty ?? this.productUomQty,
      autoid: autoid ?? this.autoid,
      entityname: entityname ?? this.entityname,
      customercontactperson:
          customercontactperson ?? this.customercontactperson,
      customercontactphone: customercontactphone ?? this.customercontactphone,
    );
  }

  @override
  String toString() {
    return '''SaleOrderLine{
      id: id,
      orderId: orderId,
      name: name,
      sequence: sequence,
      invoiceStatus: invoiceStatus,
      priceUnit: priceUnit,
      priceSubtotal: priceSubtotal,
      priceTax: priceTax,
      priceTotal: priceTotal,
      priceReduce: priceReduce,
      priceReduceTaxinc: priceReduceTaxinc,
      priceReduceTaxexcl: priceReduceTaxexcl,
      discount: discount,
      productId: productId,
      productUomQty: productUomQty,
      productUom: productUom,
      qtyDeliveredMethod: qtyDeliveredMethod,
      qtyDelivered: qtyDelivered,
      qtyDeliveredManual: qtyDeliveredManual,
      qtyToInvoice: qtyToInvoice,
      qtyInvoiced: qtyInvoiced,
      untaxedAmountInvoiced: untaxedAmountInvoiced,
      untaxedAmountToInvoice: untaxedAmountToInvoice,
      salesmanId: salesmanId,
      currencyId: currencyId,
      companyId: companyId,
      orderPartnerId: orderPartnerId,
      isExpense: isExpense,
      isDownpayment: isDownpayment,
      state: state,
      customerLead: customerLead,
      displayType: displayType,
      createUid: createUid,
      createDate: createDate,
      writeUid: writeUid,
      writeDate: writeDate,
      productPackaging: productPackaging,
      routeId: routeId,
      autoid: autoid,
      outercolor: outercolor,
      entityname: entityname,
      deliveryaddress: deliveryaddress,
      customercontactperson: customercontactperson,
      customercontactphone: customercontactphone,
      executecompany: executecompany,
      remark: remark,
    }''';
  }

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is SaleOrderLine &&
          runtimeType == other.runtimeType &&
          priceUnit == other.priceUnit &&
          productUomQty == other.productUomQty &&
          autoid == other.autoid &&
          entityname == other.entityname &&
          customercontactperson == other.customercontactperson &&
          customercontactphone == other.customercontactphone);

  factory SaleOrderLine.fromMap(Map<String, dynamic> map) {
    return new SaleOrderLine(
      autoid: map['autoid'] != false ? map['autoid'].toString() as String? : "",
      type: map['type'] != false ? map['type'].toString() as String? : "",
      defaultCode: map['default_code'] != false
          ? map['default_code'].toString() as String?
          : "",
      productName: map['product_name'] != false
          ? map['product_name'].toString() as String?
          : "",
      description: map['description'] != false
          ? map['description'].toString() as String?
          : "",
      priceUnit: map['price_unit'] != false
          ? map['price_unit'].toString() as String?
          : "",
      productUomQty: map['product_uom_qty'] != false
          ? map['product_uom_qty'].toString() as String?
          : "",
      unit: map['unit'] != false ? map['unit'].toString() as String? : "",
      totalPrice: map['total_price'] != false
          ? map['total_price'].toString() as String?
          : "",
      entityname: map['entityname'] != false
          ? map['entityname'].toString() as String?
          : "",
      customercontactperson: map['customercontactperson'] != false
          ? map['customercontactperson'].toString() as String?
          : "",
      customercontactphone: map['customercontactphone'] != false
          ? map['customercontactphone'].toString() as String?
          : "",
    );
  }

  Map<String, dynamic> toMap() {
    // ignore: unnecessary_cast
    return {
      'priceUnit': this.priceUnit,
      'productUomQty': this.productUomQty,
      'autoid': this.autoid,
      'entityname': this.entityname,
      'customercontactperson': this.customercontactperson,
      'customercontactphone': this.customercontactphone,
    } as Map<String, dynamic>;
  }

  List toDomainList() {
    List list = [
      if (this.orderId != null && this.orderId != '')
        ['order_id', '=', int.parse(this.orderId!)],
    ] as List;
    if (list.length == 0) {
      list.add(['id', '!=', null]);
    }
    // ignore: unnecessary_cast
    return list;
  }

  Map<String, dynamic> toOdooMap() {
    // ignore: unnecessary_cast
    return {
      'price_unit': this.priceUnit,
      'product_uom_qty': this.productUomQty,
      'autoid': this.autoid,
      'entityname': this.entityname,
      'customercontactperson': this.customercontactperson,
      'customercontactphone': this.customercontactphone,
    } as Map<String, dynamic>;
  }

//</editor-fold>

}
